#pragma once

#include "qlib/all.h"

namespace qbe::move {

// 移动功能流程
enum struct State { None = 0, Wait, Upatde, Complete, Cancel };

// 移动参数 [资源]
struct Param {
  State state = State::None;  // 处于什么流程
  qlib::Vec2d first_pos;      // 第一次开始移动的鼠标位置
  qlib::Vec2d last_pos;       // 上一次拖动时的鼠标位置

  bool move_to_pos = false;
  qlib::Vec2d move_vec;

  void reset() {
    state = State::None;
    moveing = false;
    moveing_first = true;
    clear = false;
    use_param = false;
    wait_clock = true;
    first_clock = false;
    enter_to_move = false;

    first_pos = qlib::Vec2d(0, 0);
    last_pos = qlib::Vec2d(0, 0);
    pos_clock = qlib::Vec2d(0, 0);

    tuodong_first = false;
  }

  bool is_key_move() { return wait_clock && !first_clock; }

  bool wait_clock = true;
  bool first_clock = false;
  qlib::Vec2d pos_clock;

  bool moveing = false;
  bool moveing_first = true;
  bool clear = false;

  bool use_param = false;

  bool pressed_inter_move = true;

  bool enter_to_move = false;
  bool tuodong_first = false;
};

}  // namespace qbe::move